@extends('backend::layout')
@section('content')

    @component('backend::component.tpl_frame')
        @slot('page_title') 全球分红奖金池 @endslot

        @slot('tools_btn')

            @component('backend::component.form.button')
                @slot('title') 测试股东分红 @endslot
                @slot('class') test-award @endslot
                @slot('icon') hcl-cf @endslot
                @slot('color') success @endslot
                @slot('params') {"url":"{{route('b_Account_test-award')}}","method":"get","type":1} @endslot
            @endcomponent

            @component('backend::component.form.button')
                @slot('title') 全球分红奖金池详细信息 @endslot
                @slot('color') danger @endslot
                @slot('elem') a @endslot
                @slot('icon') hcl-bz-qh @endslot
                @slot('class') modal-box @endslot
                @slot('params') {"area":"800px,800px","title":"全球分红奖金池详细信息"} @endslot
                @slot('href') {{route('b_PlatStats_bonus_pools_list',['type'=>1])}} @endslot
            @endcomponent
        @endslot

        @slot('icon') hcl-sell-map @endslot
        @slot('class') mt-3 @endslot
        @slot('body_content')
            <table class="table table-bordered table-striped tbody info-card">
                <tbody>
                <tr><td>总收入</td><td>总支出</td><td>总沉淀</td><td>本周新增</td></tr>
                <tr>
                    <td>{{$bonus_pools_one['inData']}}</td><td>{{$bonus_pools_one['outData']}}</td>
                    <td>{{$bonus_pools_one['surplus']}}</td><td>{{$bonus_pools_one['oneWeek_income']}}</td>
                </tr>
                </tbody>
            </table>
        @endslot
    @endcomponent

    @component('backend::component.tpl_frame')
        @slot('page_title') 股东分红奖金池 @endslot


        @slot('tools_btn')

            @component('backend::component.form.button')
                @slot('title') 测试股东分红 @endslot
                @slot('class') test-award @endslot
                @slot('icon') hcl-cf @endslot
                @slot('color') success @endslot
                @slot('params') {"url":"{{route('b_Account_test-award')}}","method":"get","type":2} @endslot
            @endcomponent

            @component('backend::component.form.button')
                @slot('title') 股东分红奖金池详细信息 @endslot
                @slot('color') danger @endslot
                @slot('elem') a @endslot
                @slot('icon') hcl-bz-qh @endslot
                @slot('class') modal-box @endslot
                @slot('params') {"area":"800px,800px","title":"股东分红奖金池详细信息"} @endslot
                @slot('href') {{route('b_PlatStats_bonus_pools_list',['type'=>2])}} @endslot
            @endcomponent
        @endslot

        @slot('icon') hcl-sell-map @endslot
        @slot('class') mt-3 @endslot
        @slot('body_content')
            <table class="table table-bordered table-striped tbody info-card">
                <tbody>
                <tr><td>总收入</td><td>总支出</td><td>总沉淀</td><td>本周新增</td></tr>
                <tr>
                    <td>{{$bonus_pools_two['inData']}}</td><td>{{$bonus_pools_two['outData']}}</td>
                    <td>{{$bonus_pools_two['surplus']}}</td><td>{{$bonus_pools_two['oneWeek_income']}}</td>
                </tr>
                </tbody>
            </table>
        @endslot
    @endcomponent

    @component('backend::component.tpl_frame')
        @slot('page_title') 福利奖奖金池 @endslot

        @slot('tools_btn')
            @component('backend::component.form.button')
                @slot('title') 福利奖奖金池详细信息 @endslot
                @slot('color') danger @endslot
                @slot('elem') a @endslot
                @slot('icon') hcl-bz-qh @endslot
                @slot('class') modal-box @endslot
                @slot('params') {"area":"800px,800px","title":"福利奖奖金池详细信息"} @endslot
                @slot('href') {{route('b_PlatStats_bonus_pools_list',['type'=>3])}} @endslot
            @endcomponent
        @endslot

        @slot('icon') hcl-sell-map @endslot
        @slot('class') mt-3 @endslot
        @slot('body_content')
            <table class="table table-bordered table-striped tbody info-card">
                <tbody>
                <tr><td style="text-align: center">总收入</td></tr>
                <tr>
                    <td style="text-align: center">{{$bonus_pools_three['inData']}}</td>
                </tr>
                </tbody>
            </table>
        @endslot
    @endcomponent

    @component('backend::component.tpl_frame')
        @slot('page_title') 合伙人分红奖金池 @endslot

        @slot('tools_btn')

            @component('backend::component.form.button')
                @slot('title') 合伙人月分红 @endslot
                @slot('elem') a @endslot
                @slot('btn') btn @endslot
                @slot('color') success @endslot
                @slot('icon') hcl-cf @endslot
                @slot('class') month_award @endslot
            @endcomponent

            @component('backend::component.form.button')
                @slot('title') 合伙人分红奖金池详细信息 @endslot
                @slot('color') danger @endslot
                @slot('elem') a @endslot
                @slot('icon') hcl-bz-qh @endslot
                @slot('class') modal-box @endslot
                @slot('params') {"area":"800px,800px","title":"合伙人分红奖金池详细信息"} @endslot
                @slot('href') {{route('b_PlatStats_bonus_pools_list',['type'=>4])}} @endslot
            @endcomponent
        @endslot

        @slot('icon') hcl-sell-map @endslot
        @slot('class') mt-3 @endslot
        @slot('body_content')
            <table class="table table-bordered table-striped tbody info-card">
                <tbody>
                <tr><td>总收入</td><td>总支出</td><td>总沉淀</td><td>本月新增</td><td>合伙人人数</td></tr>
                <tr>
                    <td>{{$bonus_pools_four['inData']}}</td><td>{{$bonus_pools_four['outData']}}</td>
                    <td>{{$bonus_pools_four['surplus']}}</td><td>{{$bonus_pools_four['oneMonth_income']}}</td><td>{{$bonus_pools_four['partner_num']}}</td>
                </tr>
                </tbody>
            </table>
        @endslot
    @endcomponent

@endsection
@push('scripts')
        <script type="text/javascript">
            layui.use(['jquery','layer'], function() {
                var layer = layui.layer,
                    $ = layui.jquery;
                $('.month_award').off('click').on('click',function () {
                    layer.confirm('确定要发放月分红?', function(index){
                        layer.prompt({
                            formType: 3,
                            title: '请输入发放的金额，不能是小于0的数字',
                        }, function(value, index, elem){
                            $.ajax({
                                type: 'POST',
                                url: "{{route('b_Account_MonthAward')}}",
                                data:{'money':value},
                                dataType: "json",
                                success:function (response) {
                                    if(response.status){
                                        layer.msg(response.msg,{icon: 6});
                                        setTimeout(function () {
                                            location.href = response.url;
                                        }, 2000);
                                    }else{
                                        layer.msg(response.msg,{icon: 5});
                                    }
                                }
                            });
                            layer.close(index);
                        });
                        layer.close(index);
                    });

                });

                $('.test-award').off('click').on('click', function () {
                    var _that = this;
                    var params = $(_that).data('params');
                    var num_type = params.type;
                    var typeText = ''
                    if (parseInt(num_type) == 1) {
                        typeText = "全球分红"
                    } else {
                        typeText = "股东分红"
                    }
                    layer.confirm('确定要发放' + typeText + '奖励?', function (index) {
                        $.ajax({
                            type: params.method,
                            url: params.url,
                            data: {'type': num_type},
                            dataType: "json",
                            success: function (response) {
                                if (response.status) {
                                    layer.msg(response.msg, {icon: 6});
                                    setTimeout(function () {
                                        location.href = response.url;
                                    }, 2000);
                                } else {
                                    layer.msg(response.msg, {icon: 5});
                                }
                            }
                        })
                        layer.close(index);
                    });
                });

            });
        </script>
@endpush